from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from presenter import postcommentpresenter
from view import baseview

class PostCommentView(baseview.BaseView):
    def get(self):
        self.templatefile = "templates/postcomment.html"
        presenter = postcommentpresenter.PostCommentPresenter(request=self.request, currentuser=users.get_current_user(), view=self)
        presenter.respondToGet()

    def post(self):
        presenter = postcommentpresenter.PostCommentPresenter(request=self.request, currentuser=users.get_current_user(), view=self)
        presenter.respondToPost()

    def showPostResponse(self, template_values, querystring):
        destination = '/topic' + querystring
        self.redirect(destination)

application = webapp.WSGIApplication(
                                     [
                                      ('/postcomment', PostCommentView)],
                                     debug=True)

def main():
  run_wsgi_app(application)

if __name__ == "__main__":
  main()